from multiprocessing import Pool
import time

def func(msg):
    print('start:',msg)
    time.sleep(2)
    print('end:',msg)

if __name__ == "__main__":
    pool = Pool(3)

    for i in range(1,6):
        msg = '任务%d'%i
        pool.apply_async(func,args=(msg,))


    # 如果进程池，不再接受新的请求，调用close
    pool.close()
    # 等待子进程结束
    pool.join()
